<!DOCTYPE html>
<html lang="en" class="[scrollbar-gutter:stable]">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="csrf-token" content={get_csrf_token()} />
    <.live_title>
      <%= assigns[:page_title] || "Sequin" %>
    </.live_title>
    <link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
    <script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
    </script>
    <!-- LOADS THE WISTIA EMBED -->
    <script src="https://fast.wistia.com/embed/medias/hw5rdi12ss.jsonp" async>
    </script>
    <script src="https://fast.wistia.com/assets/external/E-v1.js" async>
    </script>
    <!-- END WISTIA EMBED SCRIPTS-->
  </head>
  <body
    class="bg-white antialiased"
    data-ph-token={
      if Application.get_env(:sequin, Sequin.Posthog, [])[:is_disabled] do
        nil
      else
        Application.get_env(:sequin, Sequin.Posthog, [])[:frontend_api_key]
      end
    }
    data-ko-token={
      if Application.get_env(:sequin, :koala, [])[:is_disabled] do
        nil
      else
        Application.get_env(:sequin, :koala, [])[:public_key]
      end
    }
    data-long-poll-fallback-ms={
      Application.get_env(:sequin, SequinWeb.Endpoint)[:live_view][:long_poll_fallback_ms]
    }
  >
    <.svelte name="components/Toaster" />
    <%= if @current_user && @current_user.impersonating_user do %>
      <div class="w-full bg-red-300 text-black-600 py-2 font-bold flex items-center px-4">
        <div class="flex-grow text-center">
          Impersonating user: <%= @current_user.impersonating_user.name %> (<%= @current_user.impersonating_user.id %>)
        </div>
        <a
          href={~p"/admin/unimpersonate"}
          class="flex-shrink-0 bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded-md transition duration-300 ease-in-out"
        >
          End Impersonation
        </a>
      </div>
    <% end %>
    <%= @inner_content %>
  </body>
</html>
